package com.example.josan.rxbus;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class NextActivity extends AppCompatActivity {
    private static final String TAG = "NextActivity";

    @BindView(R.id.tv_update)
    TextView tvUpdate;
    @BindView(R.id.tv_update2)
    TextView tvUpdate2;
    @BindView(R.id.tv_send_name)
    TextView tvSendName;
    @BindView(R.id.tv_send_pwd)
    TextView tvSendPwd;
    @BindView(R.id.tv_refresh_data)
    TextView tvRefreshData;
    @BindView(R.id.tv_close_activity)
    TextView tvCloseActivity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_next);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.tv_update)
    public void onUpdate1() {
        RxBus.getInstance().post(User.RxBusTag.USER_CENTER, new User("这是封装的RxBusBeanjosan", 1));
    }

    @OnClick(R.id.tv_update2)
    public void onUpdate2() {
        RxBus.getInstance().post(new User(User.RxBusTag.HOME_USER, "这是封装的RxBusBeanjosan", 1));
    }

    @OnClick(R.id.tv_send_name)
    public void onTvSendNameClicked() {
        RxBus.getInstance().postString(StringBean.RxBusTag.USER_NAME, "josan name");
    }

    @OnClick(R.id.tv_send_pwd)
    public void onTvSendPwdClicked() {
        RxBus.getInstance().postString(StringBean.RxBusTag.PWD, "josan pwd");
    }

    @OnClick(R.id.tv_refresh_data)
    public void onTvRefreshDataClicked() {
        RxBus.getInstance().postEmpty(EmptyBean.RxBusTag.REFRESH_DATA);
    }

    @OnClick(R.id.tv_close_activity)
    public void onTvCloseActivityClicked() {
        RxBus.getInstance().postEmpty(EmptyBean.RxBusTag.CLOSE_ACTIVITY);
    }
}
